package com.stone.elec.rename.executor.impl;

import java.io.File;
import java.util.Arrays;

import cn.hutool.core.io.FileUtil;
import com.stone.elec.rename.config.ReNameConfig;
import com.stone.elec.rename.executor.BaseExecutor;
import com.stone.elec.rename.executor.ExecutorFactory;
import com.stone.elec.rename.utils.FileUtils;

public class ProjectExecutor implements BaseExecutor {

	private String path = "";

	private ReNameConfig reNameConfig;

	private static ProjectExecutor projectExecutor = new ProjectExecutor();

	public ProjectExecutor() {
		reNameConfig = ReNameConfig.reNameConfig;
	}

	public static void put() {
		ExecutorFactory.put("project", projectExecutor);
	}

	@Override
	public void execute() {
		//修改db
		File[] fileName = FileUtil.ls(reNameConfig.getBasePath() + "\\" + path);

		Arrays.stream(fileName).forEach(v -> {
			if (FileUtil.isDirectory(v)) {

				if (!FileUtils.fileDicNext(v)) {
					return;
				}
				//先验证文件名
				FileUtils.fileDicValidate(v);
				//开始验证项目下的文件

			}
		});

	//	log.info("获取文件列表 {}", fileName);
	}
}
